package com.lzw.breezeNovel.webApp.controller.comic;

import com.lzw.breezeNovel.common.result.Result;


import com.lzw.breezeNovel.model.entity.query.PaginationResultQuery;
import com.lzw.breezeNovel.model.entity.query.comic.CategoryQuery;
import com.lzw.breezeNovel.webApp.service.comic.ComicCategoryService;
import com.lzw.breezeNovel.webApp.vo.comic.ComicCategoryVo;
import com.lzw.breezeNovel.webApp.vo.comic.ComicVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 清风明月
 * @Package com.lzw.breezeNovel.webApp.controller.comic
 * @date 2025/3/16
 * @description 分类控制类
 */
@RestController
@RequestMapping("/app/comic/category")
@SuppressWarnings("all")
public class ComicCategoryController {

    /**
     * 注入service
     */
    @Autowired
    private ComicCategoryService comicCategoryService;

    /**
     * 获取所有的分类
     */
    @RequestMapping("/getAll")
    public Result<List<ComicCategoryVo>> getAll() {
        List<ComicCategoryVo> comicCategoryVo = comicCategoryService.getAll();
        return Result.ok(comicCategoryVo);
    }

    /**
     * 更具标签类型获取 和 类别
     */
    @RequestMapping("/getByType")
    public Result<PaginationResultQuery<ComicVo>> getByType(@RequestBody CategoryQuery categoryQuery) {
        PaginationResultQuery<ComicVo> byType =  comicCategoryService.getByType(categoryQuery);
        return Result.ok(byType);
    }


}
